<template>
  <div>
    <div style="height:750px">
      <el-table :data="
          tableData">
        <el-table-column label="问题标题" prop="title"></el-table-column>

        <el-table-column label="客户名" prop="userName"></el-table-column>
        <el-table-column prop="problemDescription" label="问题描述" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column label="联系方式" prop="phone"></el-table-column>

        <el-table-column align="right">
          <template slot="header">
            <el-input v-model="search" size="mini" placeholder="输入关键字搜索" />
          </template>
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="primary"
              icon="el-icon-circle-close"
              style="margin-right:160px"
              circle
              @click="handleEdit1(scope.$index, scope.row)"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tableData: [],
      search: "",
      workers: [],
    };
  },
  mounted() {
    this.showtable();
  },
  methods: {
    showtable() {
      this.$axios({
        method: "get",
        url: "/older/acceptedProblem",
      })
        .then((res) => {
          this.tableData = res.data.result;
          console.log(this.tableData);
        })
        .catch((error) => {
          console.log(error);
        });
    },
    handleEdit1(index, row) {
      if (confirm("确定删除吗")) {
        this.$axios({
          method: "post",
          params: {
            id: row.id,
          },
          url: "/older/deleteProblems",
        })
          .then((res) => {
            if (res.data.code == 200) {
              this.$message.success("删除成功");

              this.showtable();
            }
          })
          .catch((error) => {
            console.log(error);
          });
      }
    },
  },
};
</script>
